
import config from '@/utils/conf'
import { integraltype_listAll } from '@/api/integraltype'

class Action {

    async getTypeList(){
        const { data } = await integraltype_listAll({ company_id: localStorage.getItem('companyId') });
        let typeList = []
        if (data.status == 100) {
            typeList = data.data.rows.map(item => {
                return { value: item.id, label: item.integraltype_name }
            })
        }
        return typeList;
    }

    async getToolData(){
        const like_describes = [{ value: 0, label: '未生效' }, { value: 1, label: '已生效' }]
        const data = [
            {el: 'input', label: '角色', model: 'role_name'},
            {el: 'input', label: '描述', model: 'like_describe'},
            {el: 'select', label: '生效', model: 'effect_status', options: like_describes},
            {el: 'select', label: '积分类别', model: 'integraltype_id', options: await this.getTypeList()}
        ]
        return data;
    }

} 

const action = new Action();
export default action;